// 查询分类列表
import request from "@/utils/request";

export function listCategory(query) {
  return request({
    url: '/commodity/category/list',
    method: 'get',
    params: query
  })
}

// 查询部门列表（排除节点）
export function listCategoryExcludeChild(categoryId) {
  return request({
    url: '/commodity/category/list/exclude/' + categoryId,
    method: 'get'
  })
}
// 查询分类详细
export function getCategory(categoryId) {
  return request({
    url: '/commodity/category/' + categoryId,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/commodity/category',
    method: 'post',
    data: data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/commodity/category',
    method: 'put',
    data: data
  })
}

// 删除分类
export function delCategory(categoryId) {
  return request({
    url: '/commodity/category/' + categoryId,
    method: 'delete'
  })
}

/**
 * 修改 显示关闭状态
 * @param pram
 */
export function categroyUpdateStatus(categoryId,status) {
  return request({
    url: '/commodity/category/{categoryId}/{status}',
    method: 'GET'
  })
}
